package org.dreamwork.android.websocket;

import org.dreamwork.android.websocket.impls.async_http_client_1_9_40.AsyncHttpClientLibrary;
import org.dreamwork.android.websocket.impls.okhttp_3_6_0.OkHttpLibrary;

/**
 * Created by game on 2017/3/5
 */
public class WebSocketLibraryFactory {

    public static<T> IWebSocketLibrary create (IWebSocketListener listener, Implementation impl) {
        switch (impl) {
            case OK_HTTP_3_6_0:
                return new OkHttpLibrary (listener);
            case ASYNC_HTTP_CLIENT_1_9_40 :
                return new AsyncHttpClientLibrary (listener);
            default:
                throw new IllegalArgumentException ("unsupported implementation: " + impl);
        }
    }
}